package jfb.examples.gmf.filesystem.diagram.part.transform;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;

import jfb.examples.gmf.filesystem.diagram.part.FilesystemDiagramEditorPlugin;

public class Transformation {
    public String mDescription;
    public String mFilePath;
    public String mObjectClass;
    
    public Transformation() {}
    
    boolean init(String filename) {
    	String data = "";
		InputStream input = getClass().getClassLoader().getResourceAsStream(filename);
		try {
	        data = new java.util.Scanner(input).useDelimiter("\\A").next();
	    } catch (java.util.NoSuchElementException e) {
	    	return false;
	    }
		FilesystemDiagramEditorPlugin.getInstance().logInfo("Transformation data: " + data); 
		BufferedReader br = new BufferedReader(new StringReader(data));
		
		try {
			return ((mDescription = br.readLine()) != null && 
			    (mFilePath = br.readLine()) != null &&
			    (mObjectClass = br.readLine()) != null);
		} catch (IOException e) {
			e.printStackTrace();
		}
    	return false;
    }
    
    void execute() {
    	
    }
}
